<?php

namespace app\model\not_del;

use think\Model;
use think\model\relation\BelongsTo;

/**
 * 部门管理员
 */
class DepartmentAdminModel extends Model
{
    protected $name = 'department_admin';

    /**
     * 关联用户名称
     * @return BelongsTo
     */
    public function userName(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind(['user_name' => 'name']);
    }

    /**
     * 管理部门
     * @return BelongsTo
     */
    public function Department(): BelongsTo
    {
        return $this->belongsTo(DepartmentModel::class,'department_id')->bind([
            'department_name' => 'name',
            'department_level'=> 'level'
        ]);
    }



}